package springcloud.consume.feign.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import springcloud.consume.feign.hystrix.UserServiceFallbackFactory;
import springcloud.service.model.User;

import java.util.List;

@FeignClient(value = "SPRINGCLOUD-SERVICE", fallbackFactory = UserServiceFallbackFactory.class)
public interface UserService {

    @GetMapping(value = "/user/getUserById/{userId}")
    User getUserById(@PathVariable("userId") Integer userId);

    @PostMapping(value = "/user/addUser")
    int addUser(User user);

    @GetMapping(value = "/user/getAll")
    List<User> getAll();
}
